<?php
class sessions{
	public function __construct(){
		$this->startSession();
		$this->getSessionByName();
	}
	public function startSession(){
		session_start();
	}
	public function login_session($session){
		foreach($session as $value => $key){
			$_SESSION[$value] = $key;
		}
	} 
	public function clear_session(){
		unset($_SESSION['user_id']);
		unset($_SESSION['name']);
	}
	public function clear_sessionAll(){
		session_unset();		
		session_destroy();
	}
	public function getSession(){
		return $_SESSION;
	}
	public function getSessionByName(){
		if (!isset($_GET['lang'])){
			if (!isset($_SESSION['lang']) || $_SESSION['lang'] == ""){
				$_SESSION['lang'] = 'en';
			}
		}else{
			$_SESSION['lang'] = $_GET['lang'];
		}
		return $_SESSION['lang'];
	}
}
?>